package com.qst.crop.demo.service;

import com.qst.crop.demo.entity.OrderTable;
import com.qst.crop.demo.entity.ShoppingCart;
import com.qst.crop.demo.mapper.OrderMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OrderService {
    @Autowired
    OrderMapper orderMapper;

    public Integer updateQua(long productId, String sellerEmail, String customerEmail){
        return orderMapper.updateQua(productId, sellerEmail, customerEmail);
    }

    public Integer updateQua2(long productId, String sellerEmail, String customerEmail){
        return orderMapper.updateQua2(productId, sellerEmail, customerEmail);
    }
//
//    public Integer updatePri(double totalPrice, long productId, String ownerEmail){
//        return cartMapper.updatePri(totalPrice, productId, ownerEmail);
//    }
//
    public Integer add(OrderTable orderTable){
        return orderMapper.add(orderTable);
    }
//
    public Integer del(long productId, String sellerEmail, String customerEmail){
        return orderMapper.del(productId, sellerEmail, customerEmail);
    }
//
    public List<OrderTable> getAll(String email){
        return orderMapper.getAll(email);
    }
//
    public Long getQua(long productId, String sellerEmail, String customerEmail){
        return orderMapper.getQua(productId, sellerEmail, customerEmail);
    }

    public Integer updatePri(double totalPrice, long productId, String sellerEmail, String customerEmail){
        return orderMapper.updatePri(totalPrice, productId, sellerEmail, customerEmail);
    }

    public OrderTable getOrderByPro(long productId, String sellerEmail, String customerEmail){
        return orderMapper.getOrderByPro(productId, sellerEmail, customerEmail);
    }
}
